3.59 \(\int \frac{\tan ^4(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx\)

Optimal. Leaf size=185 \[ -\frac{(-7 B+i A) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}-\frac{-15 B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac{x (A+15 i B)}{16 a^4}-\frac{B \log (\cos (c+d x))}{a^4 d}+\frac{(-B+i A) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3} \]

[Out]

((A + (15*I)*B)*x)/(16*a^4) - (B*Log[Cos[c + d*x]])/(a^4*d) - (I*A - 15*B)/(16*a^4*d*(1 + I*Tan[c + d*x])) - (
(I*A - 7*B)*Tan[c + d*x]^2)/(16*a^4*d*(1 + I*Tan[c + d*x])^2) + ((I*A - B)*Tan[c + d*x]^4)/(8*d*(a + I*a*Tan[c
 + d*x])^4) + ((A + (3*I)*B)*Tan[c + d*x]^3)/(12*a*d*(a + I*a*Tan[c + d*x])^3)

________________________________________________________________________________________

Rubi [A]  time = 0.508708, antiderivative size = 185, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 34, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.176, Rules used = {3595, 3589, 3475, 12, 3526, 8} \[ -\frac{(-7 B+i A) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}-\frac{-15 B+i A}{16 a^4 d (1+i \tan (c+d x))}+\frac{x (A+15 i B)}{16 a^4}-\frac{B \log (\cos (c+d x))}{a^4 d}+\frac{(-B+i A) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3} \]

Antiderivative was successfully verified.

[In]

Int[(Tan[c + d*x]^4*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

((A + (15*I)*B)*x)/(16*a^4) - (B*Log[Cos[c + d*x]])/(a^4*d) - (I*A - 15*B)/(16*a^4*d*(1 + I*Tan[c + d*x])) - (
(I*A - 7*B)*Tan[c + d*x]^2)/(16*a^4*d*(1 + I*Tan[c + d*x])^2) + ((I*A - B)*Tan[c + d*x]^4)/(8*d*(a + I*a*Tan[c
 + d*x])^4) + ((A + (3*I)*B)*Tan[c + d*x]^3)/(12*a*d*(a + I*a*Tan[c + d*x])^3)

Rule 3595

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> -Simp[((A*b - a*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^n)/(2*a*f*
m), x] + Dist[1/(2*a^2*m), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 1)*Simp[A*(a*c*m + b*d*n
) - B*(b*c*m + a*d*n) - d*(b*B*(m - n) - a*A*(m + n))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A,
B}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] && GtQ[n, 0]

Rule 3589

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[(B*d)/b, Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{\tan ^4(c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^4} \, dx &=\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}-\frac{\int \frac{\tan ^3(c+d x) (4 a (i A-B)+8 i a B \tan (c+d x))}{(a+i a \tan (c+d x))^3} \, dx}{8 a^2}\\ &=\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac{\int \frac{\tan ^2(c+d x) \left (-12 a^2 (A+3 i B)-48 a^2 B \tan (c+d x)\right )}{(a+i a \tan (c+d x))^2} \, dx}{48 a^4}\\ &=-\frac{(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac{\int \frac{\tan (c+d x) \left (-24 a^3 (i A-7 B)-192 i a^3 B \tan (c+d x)\right )}{a+i a \tan (c+d x)} \, dx}{192 a^6}\\ &=-\frac{(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac{i \int \frac{24 a^4 (A+15 i B) \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{192 a^7}+\frac{B \int \tan (c+d x) \, dx}{a^4}\\ &=-\frac{B \log (\cos (c+d x))}{a^4 d}-\frac{(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}+\frac{(i A-15 B) \int \frac{\tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{8 a^3}\\ &=-\frac{B \log (\cos (c+d x))}{a^4 d}-\frac{(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac{i A-15 B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}+\frac{(A+15 i B) \int 1 \, dx}{16 a^4}\\ &=\frac{(A+15 i B) x}{16 a^4}-\frac{B \log (\cos (c+d x))}{a^4 d}-\frac{(i A-7 B) \tan ^2(c+d x)}{16 a^4 d (1+i \tan (c+d x))^2}+\frac{(i A-B) \tan ^4(c+d x)}{8 d (a+i a \tan (c+d x))^4}+\frac{(A+3 i B) \tan ^3(c+d x)}{12 a d (a+i a \tan (c+d x))^3}-\frac{i A-15 B}{16 d \left (a^4+i a^4 \tan (c+d x)\right )}\\ \end{align*}

Mathematica [A]  time = 1.19954, size = 195, normalized size = 1.05 \[ \frac{\sec ^4(c+d x) (16 (21 B-4 i A) \cos (2 (c+d x))+3 \cos (4 (c+d x)) (8 A d x+i A-128 B \log (\cos (c+d x))+120 i B d x-B)+32 A \sin (2 (c+d x))+24 i A d x \sin (4 (c+d x))+3 A \sin (4 (c+d x))+36 i A+288 i B \sin (2 (c+d x))+3 i B \sin (4 (c+d x))-360 B d x \sin (4 (c+d x))-384 i B \sin (4 (c+d x)) \log (\cos (c+d x))-96 B)}{384 a^4 d (\tan (c+d x)-i)^4} \]

Antiderivative was successfully verified.

[In]

Integrate[(Tan[c + d*x]^4*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^4,x]

[Out]

(Sec[c + d*x]^4*((36*I)*A - 96*B + 16*((-4*I)*A + 21*B)*Cos[2*(c + d*x)] + 3*Cos[4*(c + d*x)]*(I*A - B + 8*A*d
*x + (120*I)*B*d*x - 128*B*Log[Cos[c + d*x]]) + 32*A*Sin[2*(c + d*x)] + (288*I)*B*Sin[2*(c + d*x)] + 3*A*Sin[4
*(c + d*x)] + (3*I)*B*Sin[4*(c + d*x)] + (24*I)*A*d*x*Sin[4*(c + d*x)] - 360*B*d*x*Sin[4*(c + d*x)] - (384*I)*
B*Log[Cos[c + d*x]]*Sin[4*(c + d*x)]))/(384*a^4*d*(-I + Tan[c + d*x])^4)

________________________________________________________________________________________

Maple [A]  time = 0.04, size = 244, normalized size = 1.3 \begin{align*}{\frac{31\,B}{16\,{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{{\frac{17\,i}{16}}A}{{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{{\frac{i}{32}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{{a}^{4}d}}+{\frac{31\,\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{32\,{a}^{4}d}}+{\frac{{\frac{i}{8}}A}{{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{4}}}-{\frac{B}{8\,{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{4}}}+{\frac{{\frac{3\,i}{4}}B}{{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{3}}}+{\frac{7\,A}{12\,{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{3}}}-{\frac{{\frac{49\,i}{16}}B}{{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{15\,A}{16\,{a}^{4}d \left ( \tan \left ( dx+c \right ) -i \right ) }}+{\frac{B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{32\,{a}^{4}d}}+{\frac{{\frac{i}{32}}A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{{a}^{4}d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^4*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x)

[Out]

31/16/d/a^4/(tan(d*x+c)-I)^2*B-17/16*I/d/a^4/(tan(d*x+c)-I)^2*A-1/32*I/d/a^4*ln(tan(d*x+c)-I)*A+31/32/d/a^4*ln
(tan(d*x+c)-I)*B+1/8*I/d/a^4/(tan(d*x+c)-I)^4*A-1/8/d/a^4/(tan(d*x+c)-I)^4*B+3/4*I/d/a^4/(tan(d*x+c)-I)^3*B+7/
12/d/a^4/(tan(d*x+c)-I)^3*A-49/16*I/d/a^4/(tan(d*x+c)-I)*B-15/16/d/a^4/(tan(d*x+c)-I)*A+1/32/d/a^4*B*ln(tan(d*
x+c)+I)+1/32*I/d/a^4*A*ln(tan(d*x+c)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.48558, size = 359, normalized size = 1.94 \begin{align*} \frac{{\left (24 \,{\left (A + 31 i \, B\right )} d x e^{\left (8 i \, d x + 8 i \, c\right )} - 384 \, B e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) +{\left (-48 i \, A + 312 \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} +{\left (36 i \, A - 96 \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} +{\left (-16 i \, A + 24 \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 3 i \, A - 3 \, B\right )} e^{\left (-8 i \, d x - 8 i \, c\right )}}{384 \, a^{4} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

1/384*(24*(A + 31*I*B)*d*x*e^(8*I*d*x + 8*I*c) - 384*B*e^(8*I*d*x + 8*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + (-48
*I*A + 312*B)*e^(6*I*d*x + 6*I*c) + (36*I*A - 96*B)*e^(4*I*d*x + 4*I*c) + (-16*I*A + 24*B)*e^(2*I*d*x + 2*I*c)
 + 3*I*A - 3*B)*e^(-8*I*d*x - 8*I*c)/(a^4*d)

________________________________________________________________________________________

Sympy [A]  time = 35.7878, size = 360, normalized size = 1.95 \begin{align*} - \frac{B \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a^{4} d} + \begin{cases} \frac{\left (\left (24576 i A a^{12} d^{3} e^{12 i c} - 24576 B a^{12} d^{3} e^{12 i c}\right ) e^{- 8 i d x} + \left (- 131072 i A a^{12} d^{3} e^{14 i c} + 196608 B a^{12} d^{3} e^{14 i c}\right ) e^{- 6 i d x} + \left (294912 i A a^{12} d^{3} e^{16 i c} - 786432 B a^{12} d^{3} e^{16 i c}\right ) e^{- 4 i d x} + \left (- 393216 i A a^{12} d^{3} e^{18 i c} + 2555904 B a^{12} d^{3} e^{18 i c}\right ) e^{- 2 i d x}\right ) e^{- 20 i c}}{3145728 a^{16} d^{4}} & \text{for}\: 3145728 a^{16} d^{4} e^{20 i c} \neq 0 \\x \left (- \frac{A + 31 i B}{16 a^{4}} + \frac{\left (A e^{8 i c} - 4 A e^{6 i c} + 6 A e^{4 i c} - 4 A e^{2 i c} + A + 31 i B e^{8 i c} - 26 i B e^{6 i c} + 16 i B e^{4 i c} - 6 i B e^{2 i c} + i B\right ) e^{- 8 i c}}{16 a^{4}}\right ) & \text{otherwise} \end{cases} + \frac{x \left (A + 31 i B\right )}{16 a^{4}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**4*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**4,x)

[Out]

-B*log(exp(2*I*d*x) + exp(-2*I*c))/(a**4*d) + Piecewise((((24576*I*A*a**12*d**3*exp(12*I*c) - 24576*B*a**12*d*
*3*exp(12*I*c))*exp(-8*I*d*x) + (-131072*I*A*a**12*d**3*exp(14*I*c) + 196608*B*a**12*d**3*exp(14*I*c))*exp(-6*
I*d*x) + (294912*I*A*a**12*d**3*exp(16*I*c) - 786432*B*a**12*d**3*exp(16*I*c))*exp(-4*I*d*x) + (-393216*I*A*a*
*12*d**3*exp(18*I*c) + 2555904*B*a**12*d**3*exp(18*I*c))*exp(-2*I*d*x))*exp(-20*I*c)/(3145728*a**16*d**4), Ne(
3145728*a**16*d**4*exp(20*I*c), 0)), (x*(-(A + 31*I*B)/(16*a**4) + (A*exp(8*I*c) - 4*A*exp(6*I*c) + 6*A*exp(4*
I*c) - 4*A*exp(2*I*c) + A + 31*I*B*exp(8*I*c) - 26*I*B*exp(6*I*c) + 16*I*B*exp(4*I*c) - 6*I*B*exp(2*I*c) + I*B
)*exp(-8*I*c)/(16*a**4)), True)) + x*(A + 31*I*B)/(16*a**4)

________________________________________________________________________________________

Giac [A]  time = 3.43351, size = 208, normalized size = 1.12 \begin{align*} -\frac{\frac{12 \,{\left (-i \, A - B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{a^{4}} - \frac{12 \,{\left (-i \, A + 31 \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a^{4}} - \frac{25 i \, A \tan \left (d x + c\right )^{4} - 775 \, B \tan \left (d x + c\right )^{4} - 260 \, A \tan \left (d x + c\right )^{3} + 1924 i \, B \tan \left (d x + c\right )^{3} + 522 i \, A \tan \left (d x + c\right )^{2} + 1866 \, B \tan \left (d x + c\right )^{2} + 388 \, A \tan \left (d x + c\right ) - 772 i \, B \tan \left (d x + c\right ) - 103 i \, A - 103 \, B}{a^{4}{\left (\tan \left (d x + c\right ) - i\right )}^{4}}}{384 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^4*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^4,x, algorithm="giac")

[Out]

-1/384*(12*(-I*A - B)*log(tan(d*x + c) + I)/a^4 - 12*(-I*A + 31*B)*log(tan(d*x + c) - I)/a^4 - (25*I*A*tan(d*x
 + c)^4 - 775*B*tan(d*x + c)^4 - 260*A*tan(d*x + c)^3 + 1924*I*B*tan(d*x + c)^3 + 522*I*A*tan(d*x + c)^2 + 186
6*B*tan(d*x + c)^2 + 388*A*tan(d*x + c) - 772*I*B*tan(d*x + c) - 103*I*A - 103*B)/(a^4*(tan(d*x + c) - I)^4))/
d